package com.situ.library.dao.impl;

import com.situ.library.dao.IAuthDao;
import com.situ.library.pojo.entity.Auth;
import com.situ.library.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class AuthDaoImpl implements IAuthDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<Auth> selectByRole(Integer role) {
        return template.query("select * from auth where role=?",
                new BeanPropertyRowMapper<>(Auth.class), role);
    }
}